package com.github.maojx0630.easy.translate.advice;

import com.github.maojx0630.easy.translate.TranslateUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

/**
 * @author 毛家兴
 * @since 2024-02-05 09:23
 */
@Configuration
@ConditionalOnWebApplication
public class TranslateAdviceConfiguration {


  @Bean
  @Order(Integer.MIN_VALUE)
  @ConditionalOnProperty(prefix = "easy-translate", name = "enableWebAdvice", havingValue = "true",matchIfMissing = true)
  public TranslateAdvice translateAdvice(TranslateUtil translateUtil) {
    return new TranslateAdvice(translateUtil);
  }
}
